 {template '_header'}
 <div class="page-heading"> 
	
	<span class='pull-right'>
		
		 {ifp 'commission.level.add'}
                            <a class='btn btn-primary btn-sm' data-toggle='ajaxModal' href="{php echo webUrl('commission/level/add')}"><i class="fa fa-plus"></i> 添加新等级</a>
		 {/if}
                 
	</span>
	<h2>分销商等级</h2> 
</div>
 
   <div class='alert alert-info'>
    提示: 没有设置等级的分销商将按默认设置计算提成。商品指定的佣金金额的优先级仍是最高的，也就是说只要商品指定了佣金金额就按商品的佣金金额来计算，不受等级影响
</div>
            <table class="table table-responsive table-hover">
                <thead>
                    <tr>
                        <th style='width:160px;'>等级名称</th>
                        {if $set['level']>=1}<th style='width:100px;'>一级佣金比例</th>{/if}
                        {if $set['level']>=2}<th style='width:100px;'>二级佣金比例</th>{/if}
                        {if $set['level']>=3}<th style='width:100px;'>三级佣金比例</th>{/if}
                        <th>升级条件</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {loop $list $row}
                    <tr {if $row['id']=='default'}style='background:#f2f2f2'{/if}>
                        <td>{$row['levelname']}{if $row['id']=='default'}【默认等级】{/if}</td>
                        {if $set['level']>=1}<td>{php echo number_format((float)$row['commission1'],2)}%</td>{/if}
                         {if $set['level']>=2}<td>{php echo number_format((float)$row['commission2'],2)}%</td>{/if}
                          {if $set['level']>=3}<td>{php echo number_format((float)$row['commission3'],2)}%</td>{/if}
                          <td>	{if $row['id']!='default'}
						{if $leveltype==0}{if $row['ordermoney']>0}分销订单金额满 {$row['ordermoney']} 元 {else}不自动升级{/if}{/if}
						{if $leveltype==1}{if $row['ordermoney']>0}一级分销订单金额满 {$row['ordermoney']} 元 {else}不自动升级{/if}{/if}
						{if $leveltype==2}{if $row['ordercount']>0}分销订单数量满 {$row['ordercount']} 个 {else}不自动升级{/if}{/if}
						{if $leveltype==3}{if $row['ordercount']>0}一级分销订单数量满 {$row['ordercount']} 个 {else}不自动升级{/if}{/if}
						{if $leveltype==4}{if $row['ordermoney']>0}自购订单金额满 {$row['ordermoney']} 元 {else}不自动升级{/if}{/if}
						{if $leveltype==5}{if $row['ordercount']>0}自购订单数量满 {$row['ordercount']} 个 {else}不自动升级{/if}{/if}
						
						{if $leveltype==6}{if $row['downcount']>0}下级总人数满 {$row['downcount']} 个（分销商+非分销商） {else}不自动升级{/if}{/if}
						{if $leveltype==7}{if $row['downcount']>0}一级下级人数满 {$row['downcount']} 个（分销商+非分销商） {else}不自动升级{/if}{/if}
						
						{if $leveltype==8}{if $row['downcount']>0}团队总人数满 {$row['downcount']} 个（分销商） {else}不自动升级{/if}{/if}
						{if $leveltype==9}{if $row['downcount']>0}一级团队人数满 {$row['downcount']} 个（分销商） {else}不自动升级{/if}{/if}
						
						 
						{if $leveltype==10}{if $row['commissionmoney']>0}已提现佣金总金额满 {$row['commissionmoney']} 元{else}不自动升级{/if}{/if}	 
					{else}
					默认等级
					{/if}
                          </td>
                        <td>
							{ifp 'commission.level.edit'}
                            <a class='btn btn-default btn-sm' data-toggle='ajaxModal'  href="{php echo webUrl('commission/level/edit', array('id' => $row['id']))}" title="{ifp 'commission.level.edit'}编辑{else}查看{/if}"><i class='fa fa-edit'></i> {ifp 'commission.level.edit'}编辑{else}查看{/if}</a>
                            {/if} 
                            {if $row['id']!='default'}
							 {ifp 'commission.level.delete'}
								<a class='btn btn-default btn-sm' data-toggle='ajaxRemove'  href="{php echo webUrl('commission/level/delete', array('id' => $row['id']))}" data-confirm="确认删除此等级吗？"><i class='fa fa-remove'></i> 删除</a></td>
						{/if}
						{/if}

                    </tr>
                    {/loop}
                
                </tbody>
            </table>
 {template '_footer'}

